cmake_minimum_required(VERSION 3.10)
set(projectName LiteNetLib)
project(${projectName} LANGUAGES CXX C)

set(LITE_NET_LIB_VER "0.9.5.2")

set(src_code
    src/NetDebug.cpp
    src/BaseChannel.cpp
    src/NetConstants.cpp
    src/NetPacket.cpp
    src/NetPacketPool.cpp
    src/NetPeer.cpp
    src/ReliableChannel.cpp
    src/SequencedChannel.cpp
    src/NetManager.cpp
    src/NetUtils.cpp
    src/NetConnectRequestPacket.cpp
)

# find_package(libhv REQUIRED)
if (MSVC)
link_libraries(libgdi32.a libwsock32.a libws2_32.a)
elseif (MINGW)
    link_libraries(libgdi32.a libwsock32.a libws2_32.a)
endif()

include_directories(include/LiteNetLib)

add_library(${projectName} SHARED ${src_code})
target_link_libraries(${projectName} PUBLIC asio spdlog)

set_target_properties(${projectName} PROPERTIES INSTALL_RPATH "$ORIGIN")

target_include_directories(${projectName} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
